<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>容器技术</title>
</head>
<body>
<button ONCLICK="funA1()">存放内容A</button>
<button ONCLICK="funA2()">存放内容B</button>
<button onclick="funB1()">获取内容A</button>
<button onclick="funB2()">获取内容B</button>
<button onclick="funC1()">删除内容A</button>
<button onclick="funC2()">删除内容B</button>
</body>
</html>
<script>
    function funA1() {
        window.localStorage.setItem('A', '存放的内容A')
        window.localStorage.setItem('B', '存放的内容B')
        window.localStorage.setItem('A', '存放的内容A2')
    }

    function funA2() {
        window.sessionStorage.setItem('A', '2存放的内容A')
        window.sessionStorage.setItem('B', '2存放的内容B')
        window.sessionStorage.setItem('A', '2存放的内容A2')
    }

    function funB1() {
        let a = localStorage.getItem('A')
        let b = localStorage.getItem('B')
        console.log(a, b)
    }

    function funB2() {
        let a = sessionStorage.getItem('A')
        let b = sessionStorage.getItem('B')
        console.log(a, b)
    }

    function funC1() {
        localStorage.removeItem('A')
    }

    function funC2() {
        sessionStorage.removeItem('A')
    }
</script>
